using Wolfpack.Core.Interfaces.Entities;

namespace Wolfpack.Contrib.Publishers.HipChat.Formatters
{
    public abstract class MessageFormatterBase : IMessageFormatter
    {
        private readonly HipChatPublisherConfig _config;
        public const string CRLF = "<br>";

        public abstract bool AppliesToNotification(NotificationEvent notification);
        public abstract HipChatMessage Format(HipChatMessage message, NotificationEvent notification);

        protected MessageFormatterBase(HipChatPublisherConfig config)
        {
            _config = config;
        }

        protected string GetFrom(string agentId, string siteId)
        {
            if (!string.IsNullOrWhiteSpace(_config.From))
            {
                return _config.From;
            }

            return string.Format("{0} [{1}]", siteId, agentId);
        }
    }
}